/*
 * @Description: 普通流
 * @Author: rendc
 * @Date: 2024-10-15 08:55:28
 * @LastEditors: rendc
 * @LastEditTime: 2024-10-15 09:20:45
 */

// 字符流
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * Test02
 */
public class Test02 {

  public static void main(String[] args) throws Exception {
    // 创建文件字节缓冲流
    FileInputStream fis = new FileInputStream("/Users/cc/Desktop/Java/day33/test.png");
    FileOutputStream fos = new FileOutputStream("/Users/cc/Desktop/Java/day33/test_copy.png");

    // 计时
    long start = System.currentTimeMillis();
    // 读取文件
    int data;
    while ((data = fis.read()) != -1) {
      fos.write(data);
    }
    // 计时结束
    long end = System.currentTimeMillis();
    System.out.println("增强流拷贝时间：" + (end - start) + "ms");
    // 关闭流 - 只关闭增强流即可
    fos.close();
    fis.close();
  }
}